package liaotian;

import java.io.IOException;
import java.io.InputStream;
import java.net.Socket;

public class ReceiveThread implements Runnable{
    private Socket socket;
    public ReceiveThread(Socket socket) {
        this.socket = socket;
    }
    public ReceiveThread() {

    }

    @Override
    public void run() {
        while (true) {
            try {
                InputStream is = socket.getInputStream();
                byte[] bytes = new byte[1024];
                int len = is.read(bytes);
                System.out.println(new String(bytes,0,len));

            } catch (IOException e) {
                e.printStackTrace();
            }


        }
    }
}
